package com.itheima.advantagesup.controller;

import com.itheima.advantagesup.common.R;
import com.itheima.advantagesup.entity.SysMenu;
import com.itheima.advantagesup.service.MenuService;
import com.itheima.advantagesup.vo.MenuVO;
import com.itheima.advantagesup.common.R;
import com.itheima.advantagesup.entity.SysMenu;
import com.itheima.advantagesup.service.MenuService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.awt.*;

import java.util.List;

@Slf4j
@RequestMapping("/sys_menu")
@RestController
public class MenuController {
    @Autowired
    private MenuService menuService;

    /**
     * 更新菜单
     *
     * @param sysMenu 系统菜单
     * @return {@link R}<{@link ?}>
     */
    @PostMapping("/update")
    public R<?> updateMenu(@RequestBody SysMenu sysMenu) {
        menuService.updateMenu(sysMenu);
        return R.success();
    }

    @GetMapping("/rowInfo")
    private R<SysMenu> querySysMenuById(Integer id) {
        SysMenu sysMenu = menuService.querySysMenuById(id);
        return R.success(sysMenu);
    }
}
